home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
United Public Domain Gold 2
/
United Public Domain Gold 2.iso
/
utilities
/
pu086.dms
/
pu086.adf
/
clibs
/
libc.doc
< prev
next >
Wrap
Text File
|
1990-12-04
|
30KB
|
1,274 lines
NorthC Version 1.3 (c) 1990 S.Hawtin.
Permission is granted to copy this file and libc.a provided that:
1) Neither are used for commercial gain
2) This notice is included in all copies
3) Altered copies are marked as such
4) All copies of libc.a are accompanied by copies of this file.
No liability is accepted for the contents of these files.
libc.doc within NorthC library
This file outlines the functions available within the 'NorthC' standard
'C' library. In this file I have just listed the functions that exist in
the 'C' library, I felt that it would be a waste of time to explain them
all in detail, there are a lot of books on 'C' that do that better than I
could.
This file is split into three sections, firstly the NorthC specific
functions, next some general functions that are not part of ANSI and
finally the standard ANSI 'C' functions. The only functions in the
library that are not described in this document are the AmigaDOS functions
that are supported, these are listed in the file "AmigaDOS.doc" within
this directory.
The NorthC specific extensions are described in full, or at least as
close to full as you will find anywhere.
The extra functions are outlined, they are mostly fairly obvious
extensions of the standard ANSI functions.
A complete description of the ANSI C specifics can be obtained from any
book on ANSI C. I have used the descriptions in the 1989 edition of
"Standard C" by Plauger & Brodie, published by Microsoft Press, "The Waite
Group's Essential Guide to ANSI C" by Naba Barkakati is another book that
describes all the ANSI functions quite well. I have attempted to get as
close to the ANSI standard as possible and have tried to document all the
cases where the NorthC function deviates from the standard.
NorthC Specifics
When you create a program with NorthC it will automagically open the
'dos.library', 'mathffp.library' and 'mathtrans.library'. The
'exec.library' is of course always open. These libraries will be closed
for you when the program has completed.
There are a number of other libraries within AmigaDOS 1.3 that you may
want to use, the stubs for most of these libraries are provided by the
NorthC 'C' library,
Library Opened by
------- ---------
"diskfont.library" OpenLibrary("diskfont.library",0L);
"dos.library" - always open
"exec.library" - always open
"expansion.library" OpenLibrary("expansion.library",0L);
"graphics.library" OpenLibrary("graphics.library",0L);
"icon.library" OpenLibrary("icon.library",0L);
"intuition.library" OpenLibrary("intuition.library",0L);
"layers.library" OpenLibrary("layers.library",0L);
"mathffp.library" - always open
"mathieeedoubbas.library" - not supported
"mathieeedoubtrans.library" - not supported
"mathtrans.library" - always open
"translator.library" OpenLibrary("translator.library",0L);
if you want to call any of the 'C' library routines within these libraries
you must ensure that it is open first. It is important that you open the
library with a call to the routine OpenLibrary() from the NorthC 'C'
library otherwise the routines will not be able to find the library. For
example
extern long OpenLibrary();
unsigned long icon_lib = 0;
new_name(name)
char *name;
{char temp_name[32];
if (icon_lib==0)
{/* Call OpenLibrary(),
NOTE second argument is 32 bits 0L not 0 */
icon_lib = OpenLibrary("icon.library",0L);
if(icon_lib==0)
{printf("Cannot open Icon.library\n");
exit(10);
}
}
BumpRevision(temp_name,name);
strcpy(name,temp_name);
}
by using the 'C' library OpenLibrary() call the library will be
automagically linked to the calling routines and closed when the program
calls exit(), or when the main() function returns.
AMIGA NORTHC MC68000
These three preprocessor symbols are set to 1 for each compilation. Use
these in preprocessor statements to insert and remove sections of AMIGA or
NORTHC specific code. See the documentation on setlocale() for an example
of how to use these symbols.
char *chipcalloc(num_bytes,num)
int num_bytes;
int num;
char *chiprealloc(ptr,size)
char *ptr;
int size;
char *chipmalloc(num_bytes)
int num_bytes;
These three functions allocate space within the chip memory. In NorthC
1.2 there are three ways to ensure that you have "chip" memory, you can
allocate the space yourself with an AmigaDOS AllocMem() call, you can call
one of these three functions or you can call NorthC with the "-C" flag
set. If you call AllocMem() you must ensure that the memory is freed
before you end the program, the 'C' library knows nothing about
AllocMem(). If you use the NorthC "-C" flag then all the static variables
within the file will be loaded into chip memory when you run the program,
I haven't fully tested this but it should work.
char *_WBConsole
This string describes the console the program should use when called
from the workbench, by default "con:20/20/400/100/NorthC Program", it is
specified by including a global variable declaration such as
char *_WBConsole="newcon:0/0/640/200/My Prog";
in one of the source files of your program. You could get by editing the
"defaults.c" program and adding the "defaults.o" file to your build.
int _stdoutUnbuffered
Most versions of 'C' buffer their output, that is when you call fputc()
the character doesn't get written to the file immediatly, the program
stores up the characters until it has a full line, then writes the whole
lot to the file in one go. When you are dealing with files this is of
course the best thing to do, however 'C' also treats the standard output
as a file, if the standard output is buffered then you can get strange
effects for example
printf("Type <Return>:");
getchar();
will not print the string "Type <Return>:" until you put an end of line in
the buffer by hitting the <Return> key. You can get around this problem
with the fflush() function, but NorthC also allows the programmer to define
an integer called _stdoutUnbuffered if this is not zero then the "stdout"
file will be opened as an unbuffered file. Again this is in the
"defaults.c" file.
int _WithIntrCheck = 1;
void
_CheckIntr()
For this release I have taken a very simplistic attitude to interrupts,
whenever you output a character to a file or the terminal I check to see
if the user has pressed an interrupt key. This means that file output is
slower than it was. You can disable this function with the _WithIntrCheck
flag, if this is set to 0 then the function will not check the signals. This
does mean that programs are larger than they need to be because all the
signal code is being added, if you define a function called _CheckIntr() in
you program then this will be called each time a character is output.
If you have long loops with no file output then by calling _CheckIntr()
within them you will be able to stop the program with the <Control-C> key.
debug()
The NorthC 'C' library includes a function debug(), this allows computer
wizards to wander around the machine memory. If the program executes a
call such as
char *foo;
.
.
debug(foo);
then the routine will push the value foo on to the stack and print out
aline such as
C00674: 80003132 ..12
NorthC:
this shows the address of the top of the stack, "C00674", and the contents
of the top of the stack in hexidecimal and ASCII. The NorthC: prompt
shows that the routine is waiting for input, you can type the following characters
Q Quit the debugger and restart the program
X eXit the debugger and exit() the program
R Reset the address to its initial value at this level
< Go up a level
> Go down a level, make the contents of the current
location the address. This will cause problems if
the current address contains an odd number.
+ Move the address on by 4, to next long word
- Move the address back by 4
\ Move the address on by 2, to the next short word
if you type in a hexidecimal number it will be stored at the current
address. If you want to examine a random address overwrite the top stack
element with the address you want to examine, then type '>'. While using
debug() exercise extreme caution, it is easy to awaken the evil red guru.
FOPEN_MODE UNGET_TWICE UNKNOWN_FILE FILE_OFLOW MALLOC_ZERO
NOT_YET_DONE ASSERT_WRONG FP_ERROR WRITE_FAILED SEEK_FAILED
These are the error codes returned if the library is asked to do
something it doesn't like. If your program dies with a message like
"Error: 1004" look in the ":include/errno.h" file to find out what it is
complaining about. If you want to do it properly the function strerror()
will translate this error code into a string describing the error.
_cmndlen _cmndstr _stdin _stdout _fromWB _WBmsg _Task
When your program first starts the "crt0.asm" routines are called, these
set up some global variables as follows
_cmndlen the value of D0 at startup
_cmndstr the value of A0 at startup
_stdin the input file handle
_stdout the output file handle
_fromWB set to 0 if called from CLI
_WBmsg the startup workbench message
_Task the processes task structure
the _main() function uses these values to set up the argv[] array, and the
stdin, stdout and stderr file structures. If for some reason you want to
get at the original startup string, or if you need to know when you were
called from the WorkBench you can use these variables, however if you
change them then any nasty effects are your fault.
Special functions
The standard 'C' library includes a number of functions that are not
part of ANSI C but are obvious extensions of functions that are. This
section gives details of these functions. Some of these originally came
from the Sozobon 'C' library on "FISH 171".
void _div(ret,numer,denom)
div_t *ret;
int numer;
int denom;
This function computes the quotient and remainder of (numer/denom) and
places the result in the structure pointed to by ret. This function
allows programs that depend on the ANSI div() function to be ported to
NorthC, examine the section on div() to see how to use this function.
void _ldiv(ret,numer,denom)
ldiv_t *ret;
long numer;
long denom;
This function computes the quotient and remainder of (numer/denom) and
places the result in the structure pointed to by ret. This is the long
version of _div().
char *_tmpnam(base,str)
char *base;
char *str;
This function returns a temporary filename, just like tmpnam(). The
name is created by adding a decimal number to the "base" string, for example
foo = _tmpnam("df1:temp",NULL);
will set "foo" to a name such as "df1:temp47". The name is guaranteed not
to be the name of an existing file. As a matter of interest the function
tmpnam() is defined as
char *
tmpnam(str)
char *str;
{return(_tmpnam("T:TEMP",str));
}
to create a filename in the "t:" directory.
long fsystem(cmnd,infp,outfp)
char *cmnd;
FILE *infp;
FILE *outfp;
This function performs a system() call, however when the program is
called it uses the file "infp" as "stdin" and "outfp" as "stdout" and
"stderr". Like the Execute() function this will cause problems if you
attach a full file to "infp".
This function is a half-way house between system(), that just calls the
command, and Execute(), that needs the file handles. The function acts
like Execute() with FILE pointers. Whatever you do don't pass stdin as
the value of "infp".
char *itoa(n, buffer, radix)
int n;
char *buffer;
int radix;
Print a representation of the integer n into the buffer, the radix can
be any value from 2 to 16.
char *ltoa(n, buffer, radix)
long n;
char *buffer;
int radix;
Print a representation of the long n into the buffer, radix can be any
value between 2 and 16.
char *strdup(str)
char *str;
Make a copy of the string that can be manipulated.
int stricmp(str1, str2)
char *str1, *str2;
Case independent string compare routine.
int strirpl(string, ptrn, rpl, n)
char *string, *ptrn;
char *rpl;
int n;
Case independent strrpl() routine.
char *stristr(string, pattern)
char *string, *pattern;
Case independent strstr().
int strnicmp(str1, str2, limit)
char *str1, *str2;
int limit;
Case independent versions of strncmp().
char *strlwr(string)
char *string;
Convert string to lower case.
char *strnset(string, c, n)
char *string;
char c;
int n;
Set the first n elements of the string to c.
char *strset(string, c)
char *string;
char c;
Set all the elements of a string to c.
char *strpcpy(dest, start, end)
char *dest;
char *start;
char *end;
Copy the string from start to end into dest.
int strpos(string,c)
char *string;
char c;
Return the index to the first occurrence of c in the string.
char *strrev(string)
char *string;
Reverse the string.
int strrpl(string, ptrn, rpl, n)
char *string, *ptrn;
char *rpl;
int n;
Replace the first n copies of ptrn with rpl, return the number of
replacements. If n is -1 all copies will be replaced.
int strrpos(string,c)
char *string;
char c;
Find the index of the last character c in the string.
char *strrpbrk(string, set)
char *string, *set;
strpbrk() looking from the end of the string backwards.
char *strupr(string)
char *string;
Convert a string to upper case.
char *ultoa(n, buffer, radix)
unsigned long n;
char *buffer;
int radix;
Print the unsigned long n into the string using the base radix, radix
can be any value from 2 to 16.
void
_puts(str)
char *str;
This function will output a string to stdout bypassing the normal
buffering mechanism, you should use this function within the signal()
routines as the interrupt signal can be raised when the program is in the
middle of outputting to the console normally.
ANSI C
Within the ANSI part of the library I have tried to follow the
standard,here is a list of the ANSI functions and macros, I have tried to
note all the special points.
__FILE__ __LINE__ __DATE__ __TIME__ CLOCKS_PER_SEC CHAR_BIT
CHAR_MAX CHAR_MIN INT_MAX INT_MIN LONG_MAX LONG_MIN SCHAR_MAX
SCHAR_MIN SHRT_MAX SHRT_MIN UCHAR_MAX UINT_MAX ULONG_MAX USHRT_MAX
EXIT_FAILURE EXIT_SUCCESS MB_LEN_MAX MB_CUR_MAX RAND_MAX_IOFBF
_IOLBF _IONBF BUFSIZ CHAR_BIT CHAR_MAX CHAR_MIN EOF FILE
FILENAME_MAX FOPEN_MAX L_tmpnam NULL TMP_MAX EDOM ERANGE
SIGABRT SIGFPE SIGILL SIGINT SIGSEGV SIGTERM SIG_DFL
SIG_ERR SIG_IGN
All these are defined as normal.
__STDC__
This is not defined as NorthC is not a complete standard ANSI 'C'.
SEEK_CUR SEEK_END SEEK_SET
The SEEK values are different from UNIX, AmigaDOS uses the more
intuitive -1, 0 and +1, this might cause problems when porting from UNIX
or MSDOS, if you find any code that calls fseek() with explicit numbers like
fseek(fptr,0L,0);
you will have to change it to
fseek(fptr,0L,SEEK_SET);
and slap the programmer that perpetrated the original code on the wrist.
DBL_DIG DBL_EPSILON DBL_MANT_DIG DBL_MAX DBL_MAX_10_EXP DBL_MAX_EXP
DBL_MIN DBL_MIN_10_EXP DBL_MIN_EXP FLT_DIG FLT_EPSILON FLT_MANT_DIG
FLT_MAX FLT_MAX_10_EXP FLT_MAX_EXP FLT_MIN FLT_MIN_10_EXP FLT_RADIX
FLT_ROUNDS LDBL_DIG LDBL_EPSILON LDBL_MANT_DIG LDBL_MAX
LDBL_MAX_10_EXP LDBL_MAX_EXP LDBL_MIN LDBL_MIN_10_EXP LDBL_MIN_EXP
LC_ALL LC_COLLATE LC_CTYPE LC_MONETARY LC_NUMERIC LC_TIME
Not yet defined.
void abort()
int abs(i)
int i;
double acos(num)
double num;
Does not set errno to EDOM if |num| is greater than 1.
char *asctime(tptr)
struct tm *tptr;
double asin(num)
double num;
Does not set errno to EDOM if |num| is greater than 1.
void assert(test)
int test;
Will not print out the text of the test if the assertion is incorrect.
double atan(num)
double num;
double atan2(num1,num2)
double num1;
double num2;
int atexit(fun)
void (*fun)();
double atof(s)
char *s;
int atoi(s)
char *s;
long atol(s)
char *s;
char *bsearch(key,base,nelem,size,cmp)
char *key;
char *base;
int nelem;
int size;
int (*cmp)();
char *calloc(num_bytes,num)
int num_bytes;
int num;
double ceil(num)
double num;
void clearerr(stream)
FILE *stream;
clock_t clock()
As in ANSI spec this function always returns -1 as I don't know how to
get hold of the elapsed processor time since the machine was booted.
typedef ... clock_t;
double cos(num)
double num;
double cosh(num)
double num;
Does not set errno to ERANGE if num is too large.
char *ctime(cal)
time_t *cal;
double difftime(t1,t0)
time_t t1;
time_t t0;
div_t div(numer,denom)
int numer;
int denom;
As I have no plans to implement structure returning functions this will
probably not be written. Use the _div() function described in the
extensions section above, replace
the_div = div(numer,denom);
with
#ifndef NORTHC
the_div = div(numer,denom);
#else
_div(&the_div,numer,denom);
#endif
to achieve the same effect.
typedef ... div_t;
int errno;
Not set in all the places it should be.
void exit(code)
int code;
double exp(num)
double num;
Does not set errno to ERANGE if the argument is too large.
double fabs(num)
double num;
void fclose(stream)
FILE *stream;
int feof(stream)
FILE *stream;
int ferror(stream)
FILE *stream;
void fflush(stream)
FILE *stream;
char fgetc(stream)
FILE *stream;
int fgetpos(stream,pos)
FILE *stream;
int pos;
char *fgets(str, n, stream)
char *str;
int n;
FILE *stream;
double floor(num)
double num;
double fmod(num1,num2)
double num1;
double num2;
FILE *fopen(fname,mode)
char *fname;
char *mode;
typedef ... fpos_t;
void fprintf(stream, format, ...)
FILE *stream;
char *format;
void fputc(c,stream)
char c;
FILE *stream;
int fputs(str,stream)
char *str;
FILE *stream;
int fread(ptr,size,nelem,stream)
char *ptr;
int size;
int nelem;
FILE *stream;
void free(ptr)
char *ptr;
FILE *freopen(name,mode,stream)
char *name;
char *mode;
FILE *stream;
double frexp(x,pexp)
double x;
int *pexp;
void fscanf(stream, format, ...)
FILE *stream;
char *format;
Floating point formats in scanf() don't work yet, however since they
don't work in the same way on any two 'C' compilers I am not worried. If
you must read floating point numbers try fgets() and strtod(). NOTE some
UNIX 'C' libraries I know cannot even get strtod() right.
int fseek(stream,offset,mode)
FILE *stream;
long offset;
int mode;
int fsetpos(stream,pos)
FILE *stream;
int pos;
long ftell(stream)
FILE *stream;
int fwrite(ptr,size,nelem,stream)
char *ptr;
int size;
int nelem;
FILE *stream;
int getc(stream)
FILE *stream;
int getchar()
char *getenv(str)
char *str;
Uses the "env:" directory to get the value of environment variables,
will only work under AmigaDOS 1.3 or later.
char *gets(s)
char *s;
struct tm *gmtime(tod)
time_t tod;
Since I have no idea of the current time zone this is the same as
localtime(), this is normally good enough, at least here in the UK in the
winter.
int isalnum(c)
char c;
int isalpha(c)
char c;
int iscntrl(c)
char c;
int isdigit(c)
char c;
int isgraph(c)
char c;
int islower(c)
char c;
int isprint(c)
char c;
int ispunct(c)
char c;
int isspace(c)
char c;
int isupper(c)
char c;
int isxdigit(c)
char c;
typedef ... jmp_buf;
long labs(i)
long i;
struct lconv{...};
I don't plan to implement any locale stuff, I have never met a program
that uses it (probably because I am English).
double ldexp(x,exp)
double x;
int exp;
ldiv_t ldiv(numer,denom)
long numer;
long denom;
No structure returns in NorthC, use the _ldiv() function as shown in the
div() description.
typedef ... ldiv_t;
struct lconv *localeconv()
I have no plans to implement any of the locale stuff, just assume that
NorthC is always in the "C" locale. If this is really required create an
lconv structure
struct lconv
{char *currency_symbol;
char *decimal_point;
char *grouping;
char *int_curr_symbol;
char *mon_decimal_point;
char *mon_grouping;
char *mon_thousands_sep;
char *negative_sign;
char *positive_sign;
char *thousands_sep;
char frac_digits;
char int_frac_digits;
char n_cs_precedes;
char n_sep_by_space;
char n_sign_posn;
char p_cs_precedes;
char p_sep_by_space;
char p_sign_posn;
} mylconv = {"$",".","\3","USD ",".", "\3",",","-","+",",",
2,2,1,0,4, 1,0,4};
and replace all calls to localeconv() with (&mylconv).
struct tm *localtime(tod)
time_t *tod;
Same as gmtime() because I don't know which time zone we are in, for the
same reason the tm_isdst field is always 0.
double log(num)
double num;
double log10(num)
double num;
void longjmp(env,val)
jmp_buf env;
int val;
char *malloc(num_bytes)
int num_bytes;
int mblen(s,n)
char *s;
int n;
Multibyte characters are not supported, replace all calls to mblen() with
#ifndef NORTHC
foo = mblen(str,n);
#else
foo = (str==NULL?0:1);
#endif
this will be about the same.
int mbstowcs(wcs,s,n)
wchar_t *wcs;
char *s;
int n;
Multibyte characters are not supported, replace all calls to mbstowcs() with
#ifndef NORTHC
foo = mbstowcs(wcs,s,n);
#else
foo = (s!=NULL?strncpy(wcs,s,n):0);
#endif
to emulate the mbstowcs() function.
int mbtowc(pwc,s,n)
wchar_t *pwc;
char *s;
int n;
Multibyte characters are not supported, replace all calls to mbtowc() with
#ifndef NORTHC
foo = mbtowc(wcs,s,n);
#else
foo = ((s!=NULL && n!=0)?*wcs=*s:0);
#endif
to emulate the function.
char *memchr(s,c,n)
char *s;
int c;
int n;
int memcmp(s1,s2,n)
char *s1;
char *s2;
int n;
void memcpy(dest,source,length)
char *dest;
char *source;
int length;
char *memmove(s1,s2,n)
char *s1;
char *s2;
int n;
char *memset(s,c,n)
char *s;
int c;
int n;
time_t mktime(tptr)
struct tm *tptr;
Not yet written. If you want to find out the real date of 57/57/1990
you can write the function yourself. When you have done so send me a copy
and I will put it in the library.
double modf(x,pint)
double x;
double *pint;
int offsetof(type,member)
void perror(s)
char *s;
double pow(num1,num2)
double num1;
double num2;
Does not set errno to EDOM when it should.
void printf(format, ...)
char *format;
typedef ... ptrdiff_t;
int putc(c,stream)
int c;
FILE *stream;
int putchar(c)
int c;
int puts(s)
char *s;
void qsort(base,nelem,size,cmp)
char *base;
int nelem;
int size;
int (*cmp)();
int raise(sig)
int sig;
int rand()
char *realloc(ptr,size)
char *ptr;
int size;
Always creates a new block, never reuses the old location.
int remove(name)
char *name;
int rename(old,new)
char *old;
char *new;
int rewind(stream)
FILE *stream;
void scanf(format, ...)
char *format;
Cannot read floating point formats, see fscanf().
void setbuf(stream,buf)
FILE *stream;
char *buf;
int setjmp(env)
jmp_buf env;
char *setlocale(cat,locale)
int cat;
char *locale;
Locales are not supported, if you want to fake it assume that NorthC is
always in the "C" locale. Replace all calls with
#ifndef NORTHC
loc = setlocale(cat,locale);
#else
loc = ((locale==NULL || strcmp(locale,"C")==0)?"C":NULL);
#endif
this will fake the call.
int setvbuf(stream,buf,mode,size)
FILE *stream;
unsigned char *buf;
int mode;
int size;
void (*signal(sig,fun)
int sig;
void (*fun)();)()
The only signals you can get are SIGABRT, from the abort() function, and
SIGINT from the user hitting an interrupt key on the keyboard.
typedef ... sig_atomic_t;
double sin(num)
double num;
double sinh(num)
double num;
typedef ... size_t;
void sprintf(buf, format, ...)
char *buf;
char *format;
double sqrt(num)
double num;
Does not set errno to EDOM if num is negative.
void srand(seed)
int seed;
void sscanf(buf, format, ...)
char *buf;
char *format;
Cannot read floating point formats yet, see fscanf().
FILE *stderr,*stdin,*stdout;
char *strcat(dest, source)
char *dest, *source;
char *strchr(string, symbol)
char *string;
char symbol;
int strcmp(str1, str2)
char *str1;
char *str2;
int strcoll(str1,str2)
char *str1;
char *str2;
Since locales are not supported this function does not exist. If you
want to fake it replace all calls with
#ifndef NORTHC
val = strcoll(str1,str2);
#else
val = strcmp(str1,str2);
#endif
this will do the right type of thing.
char *strcpy(to, from)
char *to;
char *from;
int strcspn(str, set)
char *str;
char *set;
char *strerror(code)
int code;
long strftime(s,n,format,tptr)
char *s;
size_t n;
char *format;
struct tm *tptr;
The "%U" and "%W" specifiers are not implemented. The "%Z" specifier is
ignored, because I have no idea of the timezone.
int strlen(string)
char *string;
char *strncat(dest, source, limit)
char *dest, *source;
int limit;
int strncmp(str1, str2, limit)
char *str1, *str2;
int limit;
char *strncpy(dest, source, limit)
char *dest, *source;
int limit;
char *strpbrk(string, set)
char *string, *set;
char *strrchr(string, symbol)
char *string;
char symbol;
int strspn(string, set)
char *string, *set;
char *strstr(string, pattern)
char *string, *pattern;
double strtod(s,endptr)
char *s;
char **endptr;
Does not set errno to ERANGE if the number is too large.
char *strtok(string, delim)
char *string, *delim;
long strtol(number, nptr, base)
char *number;
char **nptr;
int base;
No overflow checking or setting of errno.
unsigned long strtoul(number, nptr, base)
char *number;
char **nptr;
int base;
No overflow checking or setting of errno.
int strxfrm(s1,s2,n)
char *s1;
char *s2;
int n;
Locales are not supported in NorthC. You can fake the call with
#ifndef NORTHC
num = strxfrm(s1,s2,n);
#else
num = strncpy(s1,s2,n);
#endif
long system(cmnd)
char *cmnd;
Executes CLI commands, assigns NULL to the input and output files, if
you want to attach a file use fsystem(). This function should return the
exit code of the program called, since I cannot work out how to get this
it always returns the value returned by the Execute() function, that is -1.
double tan(num)
double num;
Does not set errno to EDOM if num is an odd multiple of PI/2.
double tanh(num)
double num;
time_t time(tod)
time_t *tod;
struct tm {...};
FILE *tmpfile()
I am not sure how to create a file that disappears when it is closed, so
this function does not yet exist. If you want to emulate it you could try
something like
#ifdef NORTHC
char TempFileName[L_tmpnam];
char *TPtr;
DelTempFile()
{/* Delete the created temp file */
remove(TempFileName);
}
#endif
.
.
#ifndef NORTHC
fptr = tmpfile();
#else
TPtr = tmpnam();
if(TPtr)
{fptr = fopen(TPtr,"w+");
strcpy(TempFileName,TPtr);
atexit(DelTempFile);
}
#endif
and make sure that you close the file before exiting the program.
char *tmpnam(s)
char *s;
Always creates a file name in the "t:" directory, this is usually on the
ram disk, use the "assign" command to put "t:" somewhere else if you want
to move it. If you want to create a temporary file in your current
directory use _tmpnam().
char tolower(ch)
char ch;
char toupper(ch)
char ch;
void ungetc(ch,stream)
char ch;
FILE *stream;
va_arg va_end va_list va_start
void vfprintf(stream, format, ap)
FILE *stream;
char *format;
va_list ap;
void vprintf(format, ap)
char *format;
va_list ap;
void vsprintf(buf, format, ap)
char *buf;
char *format;
va_list ap;
typedef ... wchar_t;
int wcstombs(s,wcs,n)
char *s;
wchar_t *wcs;
int n;
No multibyte characters so this function does not exist, you can fake it
with
#ifndef NORTHC
num = wcstombs(s,wcs,n);
#else
num = strncpy(s,wcs,n);
#endif
this will perform the same type of function.
int wctomb(s,wchar)
char *s;
wchar_t *wchar;
There are no multibyte characters in NorthC. You can emulate this
function with
#ifndef NORTHC
num = wctomb(s,wchar);
#else
*s=*wchar;
num = 1;
#endif